
***CCES 2018***

*Post weight for validated registered voters

gen weight=vvweight_post
label variable weight "full weight"
svyset [pweight=weight]


*********************INDEPENDENT VARIABLES*********************

*Gender

gen female=.
replace female=0 if gender==1
replace female=1 if gender==2
tab female

*Race

gen white=0 
replace white=1 if race==1

gen black=0
replace black=1 if race==2

*Anti-Feminist Attitudes

gen antifeministatt=.
replace antifeministatt=1 if CC18_422d==5
replace antifeministatt=.75 if CC18_422d==4
replace antifeministatt=.5 if CC18_422d==3
replace antifeministatt=.25 if CC18_422d==2
replace antifeministatt=0 if CC18_422d==1
tab antifeministatt

*Racial resentment

gen rr1=.
replace rr1=0 if CC18_422e==5
replace rr1=.25 if CC18_422e==4
replace rr1=.5 if CC18_422e==3
replace rr1=.75 if CC18_422e==2
replace rr1=1 if CC18_422e==1
label var rr1 "Blacks should work their way up without special favors"

gen rr2=.
replace rr2=0 if CC18_422f==1
replace rr2=.25 if CC18_422f==2
replace rr2=.5 if CC18_422f==3
replace rr2=.75 if CC18_422f==4
replace rr2=1 if CC18_422f==5
label var rr2 "Generations of slavery have made it difficult for blacks to succeed"

gen rr3=.
replace rr3=0 if CC18_422g==1
replace rr3=.25 if CC18_422g==2
replace rr3=.5 if CC18_422g==3
replace rr3=.75 if CC18_422g==4
replace rr3=1 if CC18_422g==5
label var rr3 "Blacks have gotten less than they deserve"

gen rr4=.
replace rr4=0 if CC18_422h==5
replace rr4=.25 if CC18_422h==4
replace rr4=.5 if CC18_422h==3
replace rr4=.75 if CC18_422h==2
replace rr4=1 if CC18_422h==1
label var rr4 "Blacks should try harder to succeed"

alpha rr1 rr2 rr3 rr4, gen(raceres)

*Party ID

gen partyid=.
replace partyid=0 if pid7==1
replace partyid=1 if pid7==2
replace partyid=2 if pid7==3
replace partyid=3 if pid7==4
replace partyid=4 if pid7==5
replace partyid=5 if pid7==6
replace partyid=6 if pid7==7
replace partyid=partyid/6
label variable partyid "Party ID, Strong Rep=1"
tab partyid

gen partyid_3cat=.
replace partyid_3cat=0 if partyid<.5&partyid>=0
replace partyid_3cat=.5 if partyid==.5
replace partyid_3cat=1 if partyid>.5&partyid<=1
tab partyid_3cat

*Party ID dummies (Independent is the excluded category)

gen partyID_rep=.
replace partyID_rep=1 if partyid_3cat==1
replace partyID_rep=0 if partyid_3cat!=1
tab partyID_rep

gen partyID_dem=.
replace partyID_dem=1 if partyid_3cat==0
replace partyID_dem=0 if partyid_3cat!=0
tab partyID_dem

*Ideology

gen ideol=.
replace ideol=0 if ideo5==1
replace ideol=1 if ideo5==2
replace ideol=2 if ideo5==3
replace ideol=3 if ideo5==4 
replace ideol=4 if ideo5==5
replace ideol=ideol/4
label variable ideol "Ideology, Strong Cons=1"
tab ideol

*Employment status

gen working=.
replace working=1 if employ==1 | employ==2
replace working=0 if employ!=1 & employ!=2
tab working

*Marital status

gen married=.
replace married=1 if marstat==1 
replace married=0 if marstat!=1 
tab married

*Number of children under 18

gen kidsunder18=.
replace kidsunder18=0 if child18==2
replace kidsunder18=1 if child18num==1
replace kidsunder18=2 if child18num==2
replace kidsunder18=3 if child18num==3
replace kidsunder18=4 if child18num==4
replace kidsunder18=5 if child18num==5
replace kidsunder18=6 if child18num==6
replace kidsunder18=7 if child18num==7
replace kidsunder18=8 if child18num==8
replace kidsunder18=9 if child18num==9
replace kidsunder18=10 if child18num>=10 
replace kidsunder18=kidsunder18/10
tab kidsunder18

*Age

gen ageN=.
replace ageN=(2018-birthyr)/100 
tab ageN

*Education

gen education=educ
replace education=(educ-1)/5 
label variable education "Education"
tab education

*Income

gen income=faminc_new
replace income=. if faminc_new==97
replace income = (income-1)/15
label variable income "Income"
tab income

egen incomeavg=mean(income)
label variable incomeavg "Average income in year"

gen income_norm=.
replace income_norm=income/incomeavg
label variable income_norm "Normalized income - individual / average income in year"

gen income_norm01=.
replace income_norm01=income_norm/2.819746
label variable income_norm01 "Normalized income recoded 0 to 1"
tab income_norm01

*Born-again Christianity

gen bornagain=.
replace bornagain=1 if pew_bornagain==1
replace bornagain=0 if pew_bornagain==2
tab bornagain


*********************DEPENDENT VARIABLES*********************

*Self-reported vote for Trump (post-election)

gen voted_rep=.
replace voted_rep=0 if CC18_317==2 | CC18_317==3 
replace voted_rep=1 if CC18_317==1
label var voted_rep "Voted for Trump"

*Self-reported vote for Clinton (post-election)

gen voted_dem=.
replace voted_dem=0 if CC18_317==1 | CC18_317==3 
replace voted_dem=1 if CC18_317==2
label var voted_dem "Voted for Clinton"


************************ANALYSIS***********************

*Table 1

svy: logit voted_dem female antifeministatt partyid white raceres working married kidsunder18 ageN education income_norm01 bornagain
svy: logit voted_dem antifeministatt partyid white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==1
svy: logit voted_dem antifeministatt partyid white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==0


*Table 2

svy: logit voted_dem antifeministatt partyid raceres working married kidsunder18 ageN education income_norm01 bornagain if white==1&female==1
svy: logit voted_dem antifeministatt partyid raceres working married kidsunder18 ageN education income_norm01 bornagain if white==1&female==0
svy: logit voted_dem antifeministatt partyid raceres working married kidsunder18 ageN education income_norm01 bornagain if black==1&female==1
svy: logit voted_dem antifeministatt partyid raceres working married kidsunder18 ageN education income_norm01 bornagain if black==1&female==0

svy: logit voted_dem antifeministatt white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==1&partyid_3cat==0
svy: logit voted_dem antifeministatt white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==0&partyid_3cat==0
svy: logit voted_dem antifeministatt white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==1&partyid_3cat==1
svy: logit voted_dem antifeministatt white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==0&partyid_3cat==1


*Probability shifts

**All**
svy: logit voted_dem antifeministatt female partyid white raceres working married kidsunder18 ageN education income_norm01 bornagain, nolog
adjust antifeministatt=0 female partyid white raceres working married kidsunder18 ageN education income_norm01 bornagain, pr
adjust antifeministatt=1 female partyid white raceres working married kidsunder18 ageN education income_norm01 bornagain, pr

**White women
svy: logit voted_dem antifeministatt partyid raceres working married kidsunder18 ageN education income_norm01 bornagain if white==1&female==1, nolog
adjust antifeministatt=0 partyid raceres working married kidsunder18 ageN education income_norm01 bornagain if white==1&female==1, pr
adjust antifeministatt=1 partyid raceres working married kidsunder18 ageN education income_norm01 bornagain if white==1&female==1, pr

**Rep. women
svy: logit voted_dem antifeministatt white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==1&partyid_3cat==1, nolog
adjust antifeministatt=0 white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==1&partyid_3cat==1, pr
adjust antifeministatt=1 white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==1&partyid_3cat==1, pr


**********************************APPENDIX*****************************************

*Table A21

svy: logit voted_dem antifeministatt partyid ideol raceres working married kidsunder18 ageN education income_norm01 bornagain if white==1&female==1
svy: logit voted_dem antifeministatt partyid ideol raceres working married kidsunder18 ageN education income_norm01 bornagain if white==1&female==0
svy: logit voted_dem antifeministatt partyid ideol raceres working married kidsunder18 ageN education income_norm01 bornagain if black==1&female==1
svy: logit voted_dem antifeministatt partyid ideol raceres working married kidsunder18 ageN education income_norm01 bornagain if black==1&female==0


*Table A22

svy: logit voted_dem antifeministatt ideol white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==1&partyid_3cat==0
svy: logit voted_dem antifeministatt ideol white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==0&partyid_3cat==0
svy: logit voted_dem antifeministatt ideol white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==1&partyid_3cat==1
svy: logit voted_dem antifeministatt ideol white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==0&partyid_3cat==1


*Table A23

svy: logit voted_rep antifeministatt partyid raceres working married kidsunder18 ageN education income_norm01 bornagain if white==1&female==1
svy: logit voted_rep antifeministatt partyid raceres working married kidsunder18 ageN education income_norm01 bornagain if white==1&female==0
svy: logit voted_rep antifeministatt partyid raceres working married kidsunder18 ageN education income_norm01 bornagain if black==1&female==1
svy: logit voted_rep antifeministatt partyid raceres working married kidsunder18 ageN education income_norm01 bornagain if black==1&female==0


*Table A24

svy: logit voted_rep antifeministatt white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==1&partyid_3cat==0
svy: logit voted_rep antifeministatt white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==0&partyid_3cat==0
svy: logit voted_rep antifeministatt white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==1&partyid_3cat==1
svy: logit voted_rep antifeministatt white raceres working married kidsunder18 ageN education income_norm01 bornagain if female==0&partyid_3cat==1


*Table A25

svy: logit voted_dem c.antifeministatt##i.female partyid white raceres working married kidsunder18 ageN education income_norm01 bornagain
svy: logit voted_dem c.antifeministatt##i.partyID_rep c.antifeministatt##i.partyID_dem female white raceres working married kidsunder18 ageN education income_norm01 bornagain

*Wald tests 

svy: logistic voted_dem c.antifeministatt##i.female partyid white raceres working married kidsunder18 ageN education income_norm01 bornagain
testnl _b[antifeministatt#0.female] = _b[antifeministatt#1.female]

svy: logistic voted_dem c.antifeministatt##i.partyID_rep c.antifeministatt##i.partyID_dem female white raceres working married kidsunder18 ageN education income_norm01 bornagain
testnl _b[antifeministatt#1.partyID_rep] = _b[antifeministatt#1.partyID_dem]

